<template>
    <div class="container">
        <!-- <div>
            <Breadcrumb separator=">">
            <span>当前位置：</span>
                <Breadcrumb-item href="/">首页</Breadcrumb-item>
                <Breadcrumb-item>政策资讯</Breadcrumb-item>
            </Breadcrumb>
        </div> -->

        <div class="marginT20">
            <Row>
                <i-col span='2' offset='7'><span style="display:inline-block;margin-top:7px;">产品名称</span></i-col>
                <i-col span='6'><i-input placeholder="请输入..."></i-input></i-col>
                <i-col span='2' offset='1'><i-button type="success">搜索</i-button></i-col>
            </Row>
        </div>

        <div class="marginT20"> 
            <Tabs @on-click='tabCheck' value="name1" :animated="false">
                <TabPane label="政策" name="name1">
                    <div @click="goInfoDetail(item.id)" v-for="item in policyList" :key="item.id" class="marginT20 cursor-point">
                        <infoMsg :infoMsg='item' :img='banner'></infoMsg>
                    </div>
                    <div class="marginT20">
                        <Row class="marginT20">
                            <i-col span='14' offset='10'>
                                <Page  @on-change='policyPageChange' :total="policyTotal" show-elevator />
                            </i-col>
                        </Row> 
                    </div>
                    
                </TabPane>
                <TabPane label="新闻" name="name2">
                    <div @click="goInfoDetail(item.id)" v-for="item in newsList" :key="item.id" class="marginT20">
                        <infoMsg :infoMsg='item' :img='banner'></infoMsg>
                    </div>
                    <div class="marginT20">
                        <Row class="marginT20">
                            <i-col span='14' offset='10'>
                                <Page  @on-change='newsPageChange' :total="newsTotal" show-elevator />
                            </i-col>
                        </Row> 
                    </div>



                </TabPane>
            </Tabs>
        </div>

        



    </div>
</template>

<script>
import infoMsg from '@/components/infoMsg'
import banner from '@/assets/images/banner.png'
import axiosMd from '@/assets/js/interfaceClass';
export default {
    data(){
        return{
            banner:banner,
            policyList:[],
            newsList:[],
            name:'name1',
            policyTotal:null,
            newsTotal:null
        }
    },
    components:{
        infoMsg
    },
    mounted(){
        this.getPolicyList()
        this.getNewsList()
    },
    methods:{
        tabCheck(name){
            console.log(name)
            this.name=name
        },
        policyPageChange(num){
            this.getPolicyList(num)
        },
        newsPageChange(num){
            this.getNewsList(num)
        },
        getPolicyList(num){
            let page = num? num : 1
             this.$axios('getInfogetInfos',[page,10],{
                    newsType:0,
                    proCode:130000,
                    cityCode:'',
                    countyCode:'',
                    title:''
             }).then(res=>{
                console.log(res) 
                this.policyList=res.data.result
                this.policyTotal=res.data.listSize
                
                
            })
        },
        getNewsList(num){
            let page = num? num : 1
             this.$axios('getInfogetInfos',[page,10],{
                    newsType:1,
                    proCode:130000,
                    cityCode:'',
                    countyCode:'',
                    title:''
             }).then(res=>{
                console.log(res) 
                this.newsList=res.data.result
                this.newsTotal=res.data.listSize
            })
        },
        
        goInfoDetail(infoId){
            this.$router.push({
                path:'/infoDetails',
                query:{
                    infoId:infoId
                }
            })
        }




    }
}
</script>

<style>

</style>